package com.ruoyi.delivery.service.impl;

import com.ruoyi.delivery.domain.DelOutBoundDetail;
import com.ruoyi.delivery.mapper.DelOutBoundDetailMapper;
import com.ruoyi.delivery.service.IDelOutBoundDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 出库单明细 服务层实现
 *
 * @author oasis
 */
@Service
public class DelOutBoundDetailServiceImpl implements IDelOutBoundDetailService {

    @Autowired
    private DelOutBoundDetailMapper outBoundDetailMapper;

    /**
     * 根据 exitRecordId 获取所有出库明细
     *
     * @param exitRecordId 出库编号
     * @return 出库明细列表
     */
    @Override
    public List<DelOutBoundDetail> getDetailsByExitRecordId(String exitRecordId) {
        return outBoundDetailMapper.getDetailsByExitRecordId(exitRecordId);
    }

    /**
     * 插入出库单明细
     *
     * @param detail 出库明细对象
     * @return 影响的行数
     */
    @Override
    public int insertOutBoundDetail(DelOutBoundDetail detail) {
        return outBoundDetailMapper.insertOutBoundDetail(detail);
    }

    /**
     * 删除出库单明细
     *
     * @param outBoundDetailNo 出库单明细编号
     * @return 影响的行数
     */
    @Override
    public int deleteOutBoundDetail(String outBoundDetailNo) {
        return outBoundDetailMapper.deleteOutBoundDetail(outBoundDetailNo);
    }

    /**
     * 修改出库单明细
     *
     * @param detail 出库明细对象
     * @return 影响的行数
     */
    @Override
    public int updateOutBoundDetail(DelOutBoundDetail detail) {
        return outBoundDetailMapper.updateOutBoundDetail(detail);
    }

    /**
     * 获取出库明细的总记录数
     *
     * @param exitRecordId 出库编号
     * @return 出库明细的总记录数
     */
    @Override
    public int getOutBoundDetailCount(String exitRecordId) {
        return outBoundDetailMapper.getOutBoundDetailCount(exitRecordId);
    }
}
